﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

using efish.Framework.Common;

namespace efish.Framework.Web
{
    public class BasePage : System.Web.UI.Page
    {
      protected override void InitializeCulture()
      {
         //this.Culture = culture;
         //this.UICulture = culture;
      }

      protected override void OnPreInit(EventArgs e)
      {

          base.OnPreInit(e);
      }

      protected override void OnLoad(EventArgs e)
      {

          base.OnLoad(e);
      }

      public string BaseUrl
      {
          get
          {
              return WebTool.BaseUrl;
          }
      }

      public string FullBaseUrl
      {
          get
          {
              return WebTool.FullBaseUrl;
          }
      }

      protected void RequestLogin()
      {
         this.Response.Redirect(FormsAuthentication.LoginUrl + 
            "?ReturnUrl=" + this.Request.Url.PathAndQuery);
      }

      public string FormatPrice(object price)
      {
          return Convert.ToDecimal(price).ToString("N2") + " " + efishConfig.Settings.Store.CurrencyCode;
      }
    }

    public class BaseMasterPage : System.Web.UI.MasterPage
    {
        public string BaseUrl
        {
            get
            {
                return WebTool.BaseUrl;
            }
        }

        public string FullBaseUrl
        {
            get
            {
                return WebTool.FullBaseUrl;
            }
        }

        public string ImagePath
        {
            get
            {
                return FullBaseUrl + @"images/";
            }
        }
    }
}
